import urllib.request

types=[{"value":"1","desc":"课本"},{"value":"3","desc":"课外读物"}]
requestBookList="http://goodfatherapp.com/book/condition?bookTypeId="
conditionFilePath= "bookCondition_{}.json"

for ind, type in enumerate(types):
    f = open(conditionFilePath.format(type['value']), mode='w')
    textbook=urllib.request.urlopen(requestBookList + type['value']).read()
    print(textbook.decode('utf-8'), file=f)